from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.chrome.options import Options

#设置参数，无头浏览器
opt = Options()
opt.add_argument("--headless")
opt.add_argument("--disable-gpu")

web = Chrome(options=opt)

web.get('https://ys.endata.cn/BoxOffice/Ranking')

# l = web.find_elements_by_xpath('//*[@id="app"]/section/main/div/div[1]/div/section/section/section/section/div[1]/div[3]/table/tbody/tr')
l1 = web.find_elements(by=By.XPATH, value='//*[@id="app"]/section/main/div/div[1]/div/section/section/section/section/div[1]/div[3]/table/tbody/tr')
l2 = web.find_element(by=By.XPATH, value='//*[@id="app"]/section/main/div/div[1]/div/section/section/section/section/div[1]/div[3]/table')
for li in l1:
    name = li.find_element(by=By.XPATH, value='./td[2]/div/label/data').text

    print(name)

print(l2.text)

print(web.page_source) #页面源代码